import axios from 'axios'
import Storage from '../utils/storage'
import baseUrl from '../utils/baseUrl'

/**
 * 封装的ajax
 * @author：丁少华
 * @param：
 * @throws：
 * @time：2018/7/4
 */
class BaseHttp {
  // BaseHttp.token = Storage.get('token') ? Storage.get('token') : ''
  // BaseHttp.token=store.state.token?store.state.token:''


    constructor() {
        this.baseUrl = baseUrl
    }

  post (url, param) {
    return axios.post(url, param, {
      headers: {
        'package-name': process.env.VUE_APP_PACKAGE,
        'x-access-token': Storage.get('token') ? Storage.get('token') : ''
      }
    })
  }
  get (url, param) {
    return axios.get(url, param, {
      headers: {
        'package-name': process.env.VUE_APP_PACKAGE,
        'x-access-token': Storage.get('token') ? Storage.get('token') : ''
      }
    })
  }
}
export default BaseHttp
